extends Node2D
@onready var evidence_item:=$EvidenceItem
@onready var bt_ui: CanvasLayer = $BtUI
@onready var qipao: CanvasLayer = $Qipao
@onready var click_sound: AudioStreamPlayer2D = $ClickSound
@onready var renwudangan: CanvasLayer = $Renwudangan

func _process(_delta: float) -> void:
	
	if Dialogic.VAR.evidence_opened==true or Dialogic.VAR.renwudangan_opened==true:
		bt_ui.visible=false
	else:
		bt_ui.visible=true
		
	
func _ready() -> void:
	if Dialogic.VAR.loadgame==1 or Dialogic.VAR.loadgame==0:
		Dialogic.start("kaitingqian")
	if Dialogic.VAR.loadgame==2:
		Dialogic.start("zhengyan1")
	if Dialogic.VAR.loadgame==3:
		Dialogic.start("zhengyan2")
	if Dialogic.VAR.loadgame==4:
		Dialogic.start("zhengyan3")
	if Dialogic.VAR.loadgame==5:
		Dialogic.start("zhengyan4")
	if Dialogic.VAR.loadgame==6:
		Dialogic.start("zhengyan5")
	if Dialogic.VAR.loadgame==7:
		Dialogic.start("zhengyan6")
	if Dialogic.VAR.loadgame==8:
		Dialogic.start("zhengyan7")
	
	Dialogic.signal_event.connect(DialogicSignal)
	bt_ui.cszw.connect(OpenEvidence)
	bt_ui.renwudangan.connect(OpenpEvidence2)
func DialogicSignal(arguement:String):
	
	if arguement=="showevidence":
		$EvidenceItem.visible=true
	if arguement=="fini":
		get_tree().change_scene_to_file("res://menu/start.tscn")

func OpenEvidence()->void:
	evidence_item.visible=true
	Dialogic.VAR.evidence_opened=true
	
func OpenpEvidence2()->void:
	renwudangan.visible=true
	Dialogic.VAR.renwudangan_opened=true
